package com.lry.es.controller;

import com.lry.es.domain.CoursePub;
import com.lry.es.domain.CourseSearchParam;
import com.lry.es.domain.QueryResponseResult;
import com.lry.es.service.CourseSearchService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/course")
public class CourseSearchController {


    @Resource
    private CourseSearchService courseSearchService;

//    {
//        "keyword":"java",
//            "mt":"1-3",
//            "st":"1-3-3",
//            "grade":200002,
//            "price_min":30,
//            "price_max":38,
//            "sort":"price",
//            "filter":"id"
//    }
    @PostMapping("/search")
    public QueryResponseResult<CoursePub> search(@RequestBody CourseSearchParam courseSearchParam){
       return courseSearchService.search(courseSearchParam);
    }

}
